package com.hzlj.position.locate.converter;

import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;
import com.hzlj.position.locate.common.dto.reportSync.ReportSyncQueryResultDTO;
import com.hzlj.position.locate.common.dto.reportSync.ReportSyncUpsertDTO;
import com.hzlj.position.locate.common.model.ReportSync;

/**
 * 通信联络核查-同步配置表(ReportSync)DTO转换类
 *
 * @author lifh
 * @date 2023-03-13 19:17:12
 */
public class ReportSyncConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static ReportSyncQueryResultDTO from(ReportSync model) {
        return ModelDTOConverter.from(model, ReportSyncQueryResultDTO.class);
    }

    /**
     * 修改DTO转换为model实例
     *
     * @param dto 修改DTO
     * @return model实例
     */
    public static ReportSync from(ReportSyncUpsertDTO dto) {
        return ModelDTOConverter.from(dto, ReportSync.class, (ReportSync l) -> {
            l.setUpdateTime(DateUtils.now());
        });
    }
}
